<template>
  <el-card shadow="never" class="aui-card--fill">
    <div class="mod-adx__sinatask}">
      <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
        <el-form-item>
          <el-input v-model="dataForm.id" placeholder="id" clearable></el-input>
        </el-form-item>
        <el-form-item>
          <el-button @click="getDataList()">{{ $t('query') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button type="info" @click="exportHandle()">{{ $t('export') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('adx:sinatask:save')" type="primary" @click="addOrUpdateHandle()">{{ $t('add') }}</el-button>
        </el-form-item>
        <el-form-item>
          <el-button v-if="$hasPermission('adx:sinatask:delete')" type="danger" @click="deleteHandle()">{{ $t('deleteBatch') }}</el-button>
        </el-form-item>
      </el-form>
      <el-table v-loading="dataListLoading" :data="dataList" border @selection-change="dataListSelectionChangeHandle" style="width: 100%;">
        <el-table-column type="selection" header-align="center" align="center" width="50"></el-table-column>
        <el-table-column prop="id" label="主键ID" header-align="center" align="center"></el-table-column>
        <el-table-column width="100px" prop="taskName"  label="任务名称" header-align="center" align="center"></el-table-column>
        <el-table-column prop="adType" label="采买订单类型" header-align="center" align="center">
          
        </el-table-column>
        <el-table-column prop="status" label="任务状态" header-align="center" align="center"></el-table-column>
        <el-table-column prop="landingPageUrl" label="落地页地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="productName" label="产品名称" header-align="center" align="center"></el-table-column>
        <el-table-column prop="pkgName" label="包名" header-align="center" align="center"></el-table-column>
        <el-table-column prop="appUrl" :show-overflow-tooltip='true' label="下载地址" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="fastAppUrl" :show-overflow-tooltip='true'  label="投放快应用地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="fastAppName" label="" header-align="center" align="center"></el-table-column> -->
        <el-table-column prop="isRta" width="110" label="是否需要绑定" header-align="center" align="center"></el-table-column>
        <el-table-column prop="rtaurl" :show-overflow-tooltip='true' label="RTA地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="settleType" label="结算类型" header-align="center" align="center"></el-table-column>
        <el-table-column prop="budgeOrderLimit" width="110" label="预算量级限制" header-align="center" align="center"></el-table-column>
        <el-table-column prop="price" label="结算单价" header-align="center" align="center"></el-table-column>
        <el-table-column prop="deeplink" :show-overflow-tooltip='true' label="deeplink地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="fid" label="策略id" header-align="center" align="center"></el-table-column>
        <el-table-column prop="impUrls" :show-overflow-tooltip='true' label="曝光地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="clkUrls" :show-overflow-tooltip='true' label="点击地址" header-align="center" align="center"></el-table-column>
        <el-table-column prop="directional" :show-overflow-tooltip='true' label="定向要求" header-align="center" align="center"></el-table-column>
        <el-table-column prop="daypartingRemark" label="投放时段" header-align="center" align="center"></el-table-column>
        <el-table-column prop="needCreateAccount" label="是否需要开户投放" header-align="center" align="center"></el-table-column>
        <el-table-column prop="updatedAt" label="更新时间" header-align="center" align="center"></el-table-column>
        <el-table-column prop="trafficRequire" :show-overflow-tooltip='true' label="流量要求" header-align="center" align="center"></el-table-column>
        <el-table-column prop="clickRateRequire" :show-overflow-tooltip='true' label="点击率要求" header-align="center" align="center"></el-table-column>
        <el-table-column prop="cooperationSpec" :show-overflow-tooltip='true' label="合作规范" header-align="center" align="center"></el-table-column>
        <!-- <el-table-column prop="wechatName" label="" header-align="center" align="center"></el-table-column> -->
        <el-table-column :label="$t('handle')" fixed="right" header-align="center" align="center" width="150">
          <template slot-scope="scope">
            <el-button v-if="$hasPermission('adx:sinatask:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">{{ $t('update') }}</el-button>
            <el-button v-if="$hasPermission('adx:sinatask:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">{{ $t('delete') }}</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        :current-page="page"
        :page-sizes="[10, 20, 50, 100]"
        :page-size="limit"
        :total="total"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="pageSizeChangeHandle"
        @current-change="pageCurrentChangeHandle">
      </el-pagination>
      <!-- 弹窗, 新增 / 修改 -->
      <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
    </div>
  </el-card>
</template>

<script>
import mixinViewModule from '@/mixins/view-module'
import AddOrUpdate from './sinatask-add-or-update'
export default {
  mixins: [mixinViewModule],
  data () {
    return {
      mixinViewModuleOptions: {
        getDataListURL: '/adx/sinatask/page',
        getDataListIsPage: true,
        exportURL: '/adx/sinatask/export',
        deleteURL: '/adx/sinatask',
        deleteIsBatch: true
      },
      dataForm: {
        id: ''
      }
    }
  },
  components: {
    AddOrUpdate
  }
}
</script>
